package cn.es;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class T1 {
    public static void main(String[] args) {
        ExecutorService es = new ThreadPoolExecutor(3,5,1L, TimeUnit.SECONDS,new ArrayBlockingQueue<>(10), Executors.defaultThreadFactory());
        for(int i=0;i<15;i++){
            es.execute(()->{
                try{
                    TimeUnit.SECONDS.sleep(5);
                }catch(Exception e){
                    e.printStackTrace();
                }
                String t = Thread.currentThread().getName();
                System.out.println(t);
            });
        }
        es.shutdown();
    }
}
